package com.stx.action;

import com.opensymphony.xwork2.ActionSupport;
import com.stx.entity.Film;
import com.stx.entity.Film_type;
import com.stx.service.FilmService;
import com.stx.service.FilmTypeService;

public class FilmChange extends ActionSupport{

	private Film film;
	private FilmService fs;
    private Film_type film_type;
    private FilmTypeService fts;
	
    
    
	public Film_type getFilm_type() {
		return film_type;
	}

	public void setFilm_type(Film_type film_type) {
		this.film_type = film_type;
	}

	public FilmTypeService getFts() {
		return fts;
	}

	public void setFts(FilmTypeService fts) {
		this.fts = fts;
	}

	public FilmService getFs() {
		return fs;
	}

	public void setFs(FilmService fs) {
		this.fs = fs;
	}

	public Film getFilm() {
		return film;
	}

	public void setFilm(Film film) {
		this.film = film;
	}
		
public String  delFilm(){ 
		
		if(film==null){
			addActionError("删除失败");
			return "error";
		}else{
			film=fs.getFilm(film);
			if(film!=null){
				System.out.println(film.getFi_name());
			fs.delFilm(film);
			addActionError("删除成功");
			return "success";
			
			}else{
				addActionError("删除失败");
				return "error";
			}
		}
	}
	 
	public String addFilmType(){
		if(film_type==null||film==null){
			addActionError("添加失败");
			return "error";
		}else{
			film=fs.getFilm(film);
			film_type.setFilm(film);
			fts.addFilmType(film_type);
			addActionError("添加成功");
			return "success";
		}
		
	}
}
